using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace tutors_clus.Models.Mapping
{
    public class message_fileMap : EntityTypeConfiguration<message_file>
    {
        public message_fileMap()
        {
            // Primary Key
            this.HasKey(t => t.id_mes_file);

            // Properties
            // Table & Column Mappings
            this.ToTable("message_file");
            this.Property(t => t.id_mes_file).HasColumnName("id_mes_file");
            this.Property(t => t.id_mes).HasColumnName("id_mes");
            this.Property(t => t.id_att).HasColumnName("id_att");

            // Relationships
            this.HasOptional(t => t.file_attach)
                .WithMany(t => t.message_file)
                .HasForeignKey(d => d.id_att);
            this.HasOptional(t => t.message)
                .WithMany(t => t.message_file)
                .HasForeignKey(d => d.id_mes);

        }
    }
}
